#include "./../Include/public.h"
void stu_input_keyboard()
{
	printf("键盘录入输入-1时结束\n");
	printf("输入学生信息：\n");
	printf("学号 姓名 所选课程(默认为0) 总学分(默认为0)\n");
	while (1) {
		int flag = 0;
		struct stu* node = (struct stu*)malloc(sizeof(struct stu));
		scanf("%s",node->sno);
		if (!strcmp(node->sno,"-1")) return ; 
		scanf("%s %d %d",node->name,&node->courses[0],&node->sum);
		if (head_stu == NULL) {
			head_stu = node;
			printf("OK\n");
		} else {
			struct stu *p = head_stu;
			struct stu *q = p;
			while (p != NULL) {
				if (!strcmp(p->sno,node->sno)) {
					printf("学生已存在！\n");
					flag = 1;
					break;
				}
				q = p;	
				p = p->next;
			}
			if (flag) continue;
			q->next = node;
			node->next = NULL; 
			printf("OK\n");
		}
	}
}
